package com.ciwong.epaper.modules.epaper.util;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;

import com.ciwong.ciwongwrite.JournalActivity;
import com.ciwong.epaper.bean.HideDownloadDialogBean;
import com.ciwong.epaper.modules.bookstore.bean.BannerBean;
import com.ciwong.epaper.modules.bookstore.bean.NewBookReadBean;
import com.ciwong.epaper.modules.bookstore.ui.BannerAdActivity;
import com.ciwong.epaper.modules.cordva.html.NewLsWorkRcordActivity;
import com.ciwong.epaper.modules.cordva.html.TestActicity;
import com.ciwong.epaper.modules.dbbean.LswAnswer;
import com.ciwong.epaper.modules.dictation.bean.DictationAnswerInfo;
import com.ciwong.epaper.modules.dictation.ui.DictationActivity;
import com.ciwong.epaper.modules.dictation.ui.DictationRedoAndResultActivity;
import com.ciwong.epaper.modules.epaper.bean.Answer;
import com.ciwong.epaper.modules.epaper.bean.CatalogueInfo;
import com.ciwong.epaper.modules.epaper.bean.EpaperInfo;
import com.ciwong.epaper.modules.epaper.bean.ListenspeakExam;
import com.ciwong.epaper.modules.epaper.bean.Module;
import com.ciwong.epaper.modules.epaper.bean.ModuleContent;
import com.ciwong.epaper.modules.epaper.bean.ResourceDetail;
import com.ciwong.epaper.modules.epaper.bean.Subject;
import com.ciwong.epaper.modules.epaper.ui.AddBookActivity;
import com.ciwong.epaper.modules.epaper.ui.AllServiceOrBookActivity;
import com.ciwong.epaper.modules.epaper.ui.CatalogNewActivity;
import com.ciwong.epaper.modules.epaper.ui.DoWorkBrowerActivity;
import com.ciwong.epaper.modules.epaper.ui.EditBookActivity;
import com.ciwong.epaper.modules.epaper.ui.ListenSpeakResultActivity;
import com.ciwong.epaper.modules.epaper.ui.NewBookDetailH5Activity;
import com.ciwong.epaper.modules.epaper.ui.NewBookSentenceRepeatActivity;
import com.ciwong.epaper.modules.epaper.ui.NewContentActivity;
import com.ciwong.epaper.modules.epaper.ui.NewContentActivity2;
import com.ciwong.epaper.modules.epaper.ui.NewReadContentActivity;
import com.ciwong.epaper.modules.epaper.ui.SearchBookActivity;
import com.ciwong.epaper.modules.epaper.ui.SelectQuestionActivity;
import com.ciwong.epaper.modules.epaper.ui.ShopSearchBookActivity;
import com.ciwong.epaper.modules.epaper.ui.TheHearingActivity;
import com.ciwong.epaper.modules.epaper.ui.listenspeak.ListenSpeakRetryActivity;
import com.ciwong.epaper.modules.epaper.ui.newlistenspeak.LswRedoActivity;
import com.ciwong.epaper.modules.epaper.ui.newlistenspeak.NewListenSpeakActivity;
import com.ciwong.epaper.modules.epaper.ui.newlistenspeak.longcoversation.LongConversationActivity;
import com.ciwong.epaper.modules.epaper.ui.newlistenspeak.shortcoversation.ShortConversationActivity;
import com.ciwong.epaper.modules.evaluate.bean.DKWorkDays;
import com.ciwong.epaper.modules.evaluate.bean.DkWorkDetail;
import com.ciwong.epaper.modules.evaluate.bean.SentenceAnswerBean;
import com.ciwong.epaper.modules.evaluate.bean.SentencesDetail;
import com.ciwong.epaper.modules.evaluate.bean.WordDetail;
import com.ciwong.epaper.modules.evaluate.ui.SentenceAllActivity;
import com.ciwong.epaper.modules.evaluate.ui.SentenceRepeatActivity;
import com.ciwong.epaper.modules.evaluate.ui.SentenceResultActivity;
import com.ciwong.epaper.modules.evaluate.ui.StressActivity;
import com.ciwong.epaper.modules.evaluate.ui.UserDKWorkActivity;
import com.ciwong.epaper.modules.evaluate.ui.UserDkSubmitActivity;
import com.ciwong.epaper.modules.evaluate.ui.WordReadActivity;
import com.ciwong.epaper.modules.interactivetutorial.InteractiveTutorialCordovaActivity;
import com.ciwong.epaper.modules.me.bean.RequirementContent;
import com.ciwong.epaper.modules.me.bean.Service;
import com.ciwong.epaper.modules.me.bean.WorkContents;
import com.ciwong.epaper.util.IntentFlag;
import com.ciwong.epaper.util.RequestCode;
import com.ciwong.epaper.util.SerializableManager;
import com.ciwong.epaper.util.ZipPackageUtils;
import com.ciwong.epaper.util.download.DownLoadInfo;
import com.ciwong.epaper.utils.GsonUtil;
import com.ciwong.eventbus.EventBus;
import com.ciwong.libs.utils.CWSys;
import com.ciwong.libs.utils.NetworkUtils;
import com.ciwong.mobilelib.i.BaseCallBack;
import com.ciwong.mobilelib.ui.BaseActivity;
import com.ciwong.mobilelib.ui.BrowserActivity;
import com.ciwong.mobilelib.utils.BaseActivityManager;
import com.ciwong.mobilelib.utils.BaseConstants;
import com.ciwong.mobilelib.utils.BaseIntentFlag;
import com.ciwong.mobilelib.utils.BaseJumpManager;
import com.ciwong.mobilelib.utils.ToastUtil;
import com.ciwong.mobilelib.utils.XXPermissionTool;
import com.google.gson.Gson;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 电子报 跳转管理类
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/23 19:36
 * @since ciwong v.1.0
 */
public class EpaperJumpManager extends BaseJumpManager {

    /**
     * 跳转到听说模考
     *
     * @param goBackId        返回按钮的文字id
     * @param act             启动activity
     * @param workId
     * @param downLoadInfo    下载信息
     * @param module          章节详细内容
     * @param jsonVersion     json版本号
     * @param checkedResource 选中的资源
     * @param lsMode          听说模考模式
     */
    public static void jumpToListenSpeakWork(int goBackId, BaseActivity act,
                                             String workId, DownLoadInfo downLoadInfo, Module module,
                                             int position, String classId, String jsonVersion, String checkedResource,
                                             int lsMode, int serviceId, WorkContents workContents, int redoIndex, int doWorkType, boolean isCorrect) {
        jumpToListenSpeakWorkFromLsRedo(goBackId, act, workId, downLoadInfo, module, position, classId, jsonVersion, checkedResource, lsMode,
                serviceId, workContents, redoIndex, null, doWorkType, isCorrect);
    }

    public static void jumpToListenSpeakWorkFromLsRedo(final int goBackId, final BaseActivity act,
                                                       final String workId, final DownLoadInfo downLoadInfo, final Module module,
                                                       final int position, final String classId, final String jsonVersion, final String checkedResource,
                                                       final int lsMode, final int serviceId, final WorkContents workContents,
                                                       final int redoIndex, final ArrayList<LswAnswer> mLswAnswerList, final int doWorkType, final boolean isCorrect) {
        ZipPackageUtils.checkHtmlFileNeedDownload(act, new BaseCallBack() {
            @Override
            public void success(Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkFromLsRedoActual(goBackId, act, workId, downLoadInfo, module, position, classId, jsonVersion, checkedResource, lsMode, serviceId, workContents, redoIndex, mLswAnswerList, doWorkType, isCorrect);
            }

            @Override
            public void failed(int errorCode, Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkFromLsRedoActual(goBackId, act, workId, downLoadInfo, module, position, classId, jsonVersion, checkedResource, lsMode, serviceId, workContents, redoIndex, mLswAnswerList, doWorkType, isCorrect);
            }

            @Override
            public void failed(Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkFromLsRedoActual(goBackId, act, workId, downLoadInfo, module, position, classId, jsonVersion, checkedResource, lsMode, serviceId, workContents, redoIndex, mLswAnswerList, doWorkType, isCorrect);

            }
        });
    }

    private static void jumpToListenSpeakWorkFromLsRedoActual(int goBackId, Activity act, String workId, DownLoadInfo downLoadInfo, Module module, int position, String classId, String jsonVersion, String checkedResource, int lsMode, int serviceId, WorkContents workContents, int redoIndex, ArrayList<LswAnswer> mLswAnswerList, int doWorkType, boolean isCorrect) {
        Intent intent = getBaseIntent(goBackId, act,
                NewListenSpeakActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_STR, jsonVersion);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, lsMode);
        //        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, answer);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_WORK_CONTENTS, workContents);
        intent.putExtra(IntentFlag.INTENT_FLAG_LISTEN_SPEAK_ANSWERS, mLswAnswerList);
        intent.putExtra(IntentFlag.INTENT_FLAG_REDO_QUES_INDEX, redoIndex);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_TYPE, doWorkType);
        intent.putExtra(IntentFlag.INTENT_FLAG_CORRECT, isCorrect);
        act.startActivity(intent);
    }


    /**
     * 跳转到听说模考
     *
     * @param goBackId        返回按钮的文字id
     * @param act             启动activity
     * @param workId
     * @param checkedResource 选中的资源
     * @param lsMode          听说模考模式
     * @param isCorrect       是否来自是订正错题
     */
    public static void jumpToListenSpeakWorkNew(final int goBackId, final BaseActivity act, final boolean isCorrect, final String workId, final long effectivDate, final DownLoadInfo downLoadInfo, final String classId, final String checkedResource, final int lsMode, final int serviceId, final WorkContents workContents, final int redoIndex, final int doWorkType) {
//        if(isContainsActivityInStack(NewListenSpeakActivity.class)){
//            return;
//        }
        ZipPackageUtils.checkHtmlFileNeedDownload(act, new BaseCallBack() {
            @Override
            public void success(Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkNewActual(goBackId, act, isCorrect, workId, effectivDate, downLoadInfo, classId, checkedResource, lsMode, serviceId, workContents, redoIndex, doWorkType);
            }

            @Override
            public void failed(int errorCode, Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkNewActual(goBackId, act, isCorrect, workId, effectivDate, downLoadInfo, classId, checkedResource, lsMode, serviceId, workContents, redoIndex, doWorkType);
            }

            @Override
            public void failed(Object data) {
                EventBus.getDefault().post(new HideDownloadDialogBean(true));
                jumpToListenSpeakWorkNewActual(goBackId, act, isCorrect, workId, effectivDate, downLoadInfo, classId, checkedResource, lsMode, serviceId, workContents, redoIndex, doWorkType);

            }
        });
    }

    private static void jumpToListenSpeakWorkNewActual(int goBackId, Activity act, boolean isCorrect, String workId, long effectivDate, DownLoadInfo downLoadInfo, String classId, String checkedResource, int lsMode, int serviceId, WorkContents workContents, int redoIndex, int doWorkType) {
        Intent intent = getBaseIntent(goBackId, act,
                NewListenSpeakActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectivDate);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, lsMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_WORK_CONTENTS, workContents);
        intent.putExtra(IntentFlag.INTENT_FLAG_REDO_QUES_INDEX, redoIndex);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_TYPE, doWorkType);
        intent.putExtra(IntentFlag.INTENT_FLAG_CORRECT, isCorrect);
        act.startActivity(intent);
    }


    /**
     * 跳转到长对话
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     */
    public static void jumpToListenSpeakWorkLongOrShortConAct(int type, int goBackId, Activity act, ArrayList<ResourceDetail> isDoRecords, int mode,
                                                              int curQuestionNo, List<ResourceDetail> items, boolean isShow, String title, String uuid, boolean ispalyStart, ArrayList<LswAnswer> lswAnswers, int requestcode, int doWorkType, int mQuesTotalIndex) {
        if (act != null && act instanceof NewListenSpeakActivity) {
            NewListenSpeakActivity newListenSpeakActivity = (NewListenSpeakActivity) act;
            newListenSpeakActivity.isShowTips = false;
        }
        Intent intent;
        if (type == 11) {
            intent = getBaseIntent(goBackId, act,
                    LongConversationActivity.class);
        } else {
            intent = getBaseIntent(goBackId, act,
                    ShortConversationActivity.class);
        }
        intent.putExtra(IntentFlag.INTENT_FLAG_TITLE, title);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_RECORDS, isDoRecords);
        if (items != null && items.size() > 0 && items.size() >= curQuestionNo) {
            intent.putExtra(IntentFlag.INTENT_FLAG_QUE_ITEM, items.get(curQuestionNo));
        } else {
            return;
        }
        intent.putExtra(IntentFlag.INTENT_FLAG_CUR_NO, curQuestionNo);
        intent.putExtra(IntentFlag.INTENT_FLAG_TOTAL_NUM, items.size());
        intent.putExtra(IntentFlag.INTENT_FLAG_LISTEN_SPEAK_ANSWERS, lswAnswers);
        intent.putExtra(IntentFlag.INTENT_FLAG_LISTEN_MODE, mode);
        intent.putExtra(IntentFlag.INTENT_FLAG_IS_SHOW, isShow);
        intent.putExtra(IntentFlag.INTENT_FLAG_IS_PLAY_STAET, ispalyStart);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_TYPE, doWorkType);
        intent.putExtra(IntentFlag.INTENT_TOTAL_INDEX, mQuesTotalIndex);
        act.startActivityForResult(intent, requestcode);
    }


    private static boolean isContainsActivityInStack(Class clazz) {
        if (clazz != null) {
            return BaseActivityManager.getInstance().isContainsActivityInStack(clazz);
        }
        return false;
    }

    /**
     * 跳转到听说模考交作业界面
     *
     * @param goBackId
     * @param act
     * @param requestCode
     */
    public static void jumpToListenSpeakResult(int goBackId, Activity act, boolean isCorrect, final DownLoadInfo downLoadInfo, final Module module, String checkedResource,
                                               final int position, String workId, String classId, int totalTime, int serviceId, ArrayList<LswAnswer> userAnswerseList, ListenspeakExam listenspeakExam, int requestCode, WorkContents workContents, int lsMode, int doWorkType, long effectiveDate) {

        Intent intent = getBaseIntent(goBackId, act,
                ListenSpeakResultActivity.class);
        intent.putExtras(act.getIntent());
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_EXAM, listenspeakExam);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, totalTime);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, userAnswerseList);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_WORK_CONTENTS, workContents);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, lsMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_TYPE, doWorkType);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);
        intent.putExtra(IntentFlag.INTENT_FLAG_CORRECT, isCorrect);
        act.startActivityForResult(intent, requestCode);

    }

    /**
     * 跳转到单词跟读
     *
     * @param goBackId           返回按钮的文字id
     * @param act                启动activity
     * @param workId
     * @param downLoadInfo       下载信息
     * @param module             章节详细内容
     * @param requirementContent 资源作业要求
     * @param position           章节详细资源下标
     * @param wordReadMode       单词跟读模式
     * @param requestCode        请求码
     */
    public static void jumpToWordRead(int goBackId, Activity act, String workId,
                                      DownLoadInfo downLoadInfo, Module module,
                                      RequirementContent requirementContent,
                                      int position, int wordReadMode, int requestCode, String classId, String versionId, int workType, boolean isWordsRepeat, WorkContents workContents, long effectiveDate) {

        if (isContainsActivityInStack(WordReadActivity.class)) {
            return;
        }

        Intent intent = getBaseIntent(goBackId, act, WordReadActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_REQU_CONTENT,
                requirementContent);

        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, wordReadMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, workType);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, isWordsRepeat);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);
        //从哪个页面进入单词页面
        intent.putExtra(IntentFlag.INTENT_FLAG_REQUEST_CODE_FROM, requestCode);


        if (null != versionId) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENT, versionId);
        }

        if (null != workContents) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContents);
            intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                    workContents.getCheckedResource());
        }
        act.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到单词跟读  重读某个单词
     *
     * @param goBackId    返回按钮的文字id
     * @param act         启动activity
     * @param requestCode 请求码
     */
    public static void jumpToWordReadRepeat(int goBackId, Activity act, WordDetail wordDetail, DownLoadInfo mDownLoadInfo, boolean isWordsRepaet
            , int readMode, String uuid, int requestCode, String title, boolean mIsShouDongMode) {
        Intent intent = getBaseIntent(goBackId, act, WordReadActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, (Serializable) wordDetail);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, isWordsRepaet);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, readMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, mDownLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_TITLE, title);
        intent.putExtra(IntentFlag.INTENT_FLAG_IS_SHOUDONG_MODE, mIsShouDongMode);
        act.startActivityForResult(intent, requestCode);
    }

    public static void jumpToWordReadRepeat(int goBackId, Activity act, List<WordDetail> wordDetail, DownLoadInfo mDownLoadInfo, boolean isWordsRepaet
            , int readMode, String uuid, int requestCode, String title) {
        Intent intent = getBaseIntent(goBackId, act, WordReadActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, (Serializable) wordDetail);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, isWordsRepaet);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, readMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, mDownLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_TITLE, title);
        act.startActivityForResult(intent, requestCode);
    }

    public static void jumpToSentenceNewBook(final int goBackId, final Activity act,
                                          final String workId, final DownLoadInfo downLoadInfo, final String jsonStr,String moduleId,
                                          final int position, final int listenerMode, final int requestCode, final int serviceId, final String classId, final int contentId, final WorkContents workContents, final long effectiveDate) {
        if (isContainsActivityInStack(SentenceRepeatActivity.class)) {
            return;
        }
        if (!TextUtils.isEmpty(moduleId)){
            downLoadInfo.setModuleId(moduleId);
        }
        final Intent intent = getBaseIntent(goBackId, act,
                NewBookSentenceRepeatActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, jsonStr);
//        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
//                checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, listenerMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);

        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CONTENTID, contentId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);

        if (null != workContents) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContents);
            intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, workContents.getCheckedResource());
        }
        act.startActivityForResult(intent, requestCode);

//        final String saveUUid = CWSys.getSharedString(RepeatKeyUtil.getUuidSaveKey(downLoadInfo, module, position, workId, listenerMode), null);
//
//        SerializableManager.getInstance().deSerialize(RepeatKeyUtil.getSaveRepeatAnswerListKey(downLoadInfo, module, position, workId, saveUUid),
//                new BaseCallBack() {
//
//                    @Override
//                    public void success(Object data) {
//
//                        final ArrayList<SentenceAnswerBean> answerList = (ArrayList<SentenceAnswerBean>) data;
//                        if (answerList != null && answerList.size() > 0) {
//
////                            String keyTemp=ESystem.getSaveRecordKey(downLoadInfo, module, position, workId,
////                                    SerializableManager.SerializeKey.SHARE_KEY_SENTENCE_STATE + listenerMode);
//
//                            String keyTemp = RepeatKeyUtil.getSaveSentenceRepeatStatueKey(downLoadInfo, module, position, workId, saveUUid);
//
//                            SerializableManager.getInstance().deSerialize(keyTemp, new BaseCallBack() {
//
//                                @Override
//                                public void success(Object data) {
//                                    Integer state = (Integer) data;
//                                    if (state.equals(SentenceResultActivity.SENTENCE_STATE_FAIL) || state.equals(SentenceResultActivity.SENTENCE_STATE_DEF)) {
//                                        //代表提交过 且失败了
//                                        jumpToSentenceResult(goBackId, act, workId, downLoadInfo, module, requirementContent, position, listenerMode, serviceId, classId, contentId, answerList, state, workContents, effectiveDate);
//                                    } else {
//                                        act.startActivityForResult(intent, requestCode);
//                                    }
//                                }
//
//                                @Override
//                                public void failed(int errorCode, Object data) {
//                                    act.startActivityForResult(intent, requestCode);
//                                }
//
//                                @Override
//                                public void failed(Object data) {
//                                    act.startActivityForResult(intent, requestCode);
//                                }
//                            });
//                        } else {
//                            act.startActivityForResult(intent, requestCode);
//                        }
//                    }
//
//                    @Override
//                    public void failed(int errorCode, Object data) {
//                        failed(null);
//                    }
//
//                    @Override
//                    public void failed(Object data) {
//                        act.startActivityForResult(intent, requestCode);
//                    }
//                });

    }

    /**
     * 跳转到句子跟读
     *
     * @param goBackId           返回按钮的文字id
     * @param act                启动activity
     * @param workId
     * @param downLoadInfo       下载信息
     * @param module             章节详细内容
     * @param requirementContent 作业要求
     * @param position           章节详细资源下标
     * @param listenerMode       句子跟读类型 {@link //SentenceSpeechControler.LISTENER_MODE_ZHUJU}
     *                           {@link //SentenceSpeechControler.LISTENER_MODE_DULI}
     *                           {@link //SentenceSpeechControler.LISTENER_MODE_XUANDUAN}
     * @param requestCode        请求码
     */
    public static void jumpToSentenceRead(final int goBackId, final Activity act,
                                          final String workId, final DownLoadInfo downLoadInfo, final Module module,
                                          final RequirementContent requirementContent,
                                          final int position, final int listenerMode, final int requestCode, final int serviceId, final String classId, final int contentId, final WorkContents workContents, final long effectiveDate) {
        if (isContainsActivityInStack(SentenceRepeatActivity.class)) {
            return;
        }
        final Intent intent = getBaseIntent(goBackId, act,
                SentenceRepeatActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_REQU_CONTENT,
                requirementContent);
//        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
//                checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, listenerMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);

        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CONTENTID, contentId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);

        if (null != workContents) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContents);
            intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, workContents.getCheckedResource());
        }

        final String saveUUid = CWSys.getSharedString(RepeatKeyUtil.getUuidSaveKey(downLoadInfo, module, position, workId, listenerMode), null);

        SerializableManager.getInstance().deSerialize(RepeatKeyUtil.getSaveRepeatAnswerListKey(downLoadInfo, module, position, workId, saveUUid),
                new BaseCallBack() {

                    @Override
                    public void success(Object data) {

                        final ArrayList<SentenceAnswerBean> answerList = (ArrayList<SentenceAnswerBean>) data;
                        if (answerList != null && answerList.size() > 0) {

//                            String keyTemp=ESystem.getSaveRecordKey(downLoadInfo, module, position, workId,
//                                    SerializableManager.SerializeKey.SHARE_KEY_SENTENCE_STATE + listenerMode);

                            String keyTemp = RepeatKeyUtil.getSaveSentenceRepeatStatueKey(downLoadInfo, module, position, workId, saveUUid);

                            SerializableManager.getInstance().deSerialize(keyTemp, new BaseCallBack() {

                                @Override
                                public void success(Object data) {
                                    Integer state = (Integer) data;
                                    if (state.equals(SentenceResultActivity.SENTENCE_STATE_FAIL) || state.equals(SentenceResultActivity.SENTENCE_STATE_DEF)) {
                                        //代表提交过 且失败了
                                        jumpToSentenceResult(goBackId, act, workId, downLoadInfo, module, requirementContent, position, listenerMode, serviceId, classId, contentId, answerList, state, workContents, effectiveDate);
                                    } else {
                                        act.startActivityForResult(intent, requestCode);
                                    }
                                }

                                @Override
                                public void failed(int errorCode, Object data) {
                                    act.startActivityForResult(intent, requestCode);
                                }

                                @Override
                                public void failed(Object data) {
                                    act.startActivityForResult(intent, requestCode);
                                }
                            });
                        } else {
                            act.startActivityForResult(intent, requestCode);
                        }
                    }

                    @Override
                    public void failed(int errorCode, Object data) {
                        failed(null);
                    }

                    @Override
                    public void failed(Object data) {
                        act.startActivityForResult(intent, requestCode);
                    }
                });

    }


    /**
     * 跳转到句子跟读
     *
     * @param goBackId           返回按钮的文字id
     * @param act                启动activity
     * @param workId
     * @param downLoadInfo       下载信息
     * @param module             章节详细内容
     * @param requirementContent 作业要求
     * @param position           章节详细资源下标
     * @param listenerMode       句子跟读类型 {@link //SentenceSpeechControler.LISTENER_MODE_ZHUJU}
     *                           {@link //SentenceSpeechControler.LISTENER_MODE_DULI}
     *                           {@link //SentenceSpeechControler.LISTENER_MODE_XUANDUAN}
     */
    public static void jumpToSentenceResult(int goBackId, Activity act,
                                            String workId, DownLoadInfo downLoadInfo, Module module,
                                            RequirementContent requirementContent,
                                            int position, int listenerMode, int serviceId, String classId, int contentId, ArrayList<SentenceAnswerBean> resultAnsers, int state, final WorkContents workContents, long effectiveDate) {
        Intent intent = getBaseIntent(goBackId, act,
                SentenceResultActivity.class);
        Gson gson = new Gson();
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_REQU_CONTENT,
                requirementContent);


        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, listenerMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);

        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CONTENTID, contentId);
        //将答案存入缓存 避免因数据过大造成TransactionTooLargeException异常
        if (null != resultAnsers && resultAnsers.size() > 0) {
            String resultAnserString = gson.toJson(resultAnsers);
            CWSys.setSharedString(BaseConstants.SHARE_KEY_SENTENCE_ANSWER, resultAnserString);
        }
        //intent.putExtra(IntentFlag.INTENT_FLAG_SENTENCE_REUSLT, resultAnsers);
        intent.putExtra(IntentFlag.INTENT_FLAG_UPLOAD_FAIL, state);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);

        if (null != workContents) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContents);
            intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                    workContents.getCheckedResource());
        }
//        act.startActivity(intent);
        act.startActivityForResult(intent, RequestCode.MainActivityResquestCode.REQUEST_CODE_TO_DO_WORK);
    }


    /**
     * 全文跟读
     *
     * @param goBackId
     * @param act
     * @param list
     */
    public static void jumpToSentenceAll(int goBackId, Activity act, ArrayList<SentencesDetail> list, Module module, int position, DownLoadInfo downLoadInfo) {
        Intent intent = getBaseIntent(goBackId, act, SentenceAllActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_SENTENCES_LIST, list);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        act.startActivity(intent);
    }

    public static void jumpToSentenceStress(int goBackId, Activity act, ArrayList<SentencesDetail> list, ArrayList<SentenceAnswerBean> an, int index, int requestCode, Module module, int position, int listenerMode, DownLoadInfo downLoadInfo, boolean mIsReadingMode) {
        Intent intent = getBaseIntent(goBackId, act, StressActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_SENTENCES_LIST, list);
        intent.putExtra(IntentFlag.INTENT_FLAG_SENT_AN, an);
        intent.putExtra(IntentFlag.INTENT_FLAG_SENT_INDEX, index);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, listenerMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_BOOLEAN, mIsReadingMode);
        act.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到选择题目界面
     *
     * @param goBackId
     * @param act
     * @param isDoRecords 是否做的记录
     * @param requestCode
     */
    public static void jumpToSelectQuestion(int goBackId, Activity act,
                                            ArrayList<Boolean> isDoRecords, int requestCode) {
        Intent intent = getBaseIntent(goBackId, act,
                SelectQuestionActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, isDoRecords);
        act.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到报听写页面
     *
     * @param goBackId     返回按钮的文字id
     * @param act          启动Activity
     * @param downLoadInfo 文件下载对象
     * @param module       章节详细内容
     * @param position     章节详细资源下标
     */
    public static void jumpToDictaion(int goBackId, Activity act,
                                      DownLoadInfo downLoadInfo, Module module, int position) {
        Intent intent = getBaseIntent(goBackId, act, TheHearingActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        act.startActivity(intent);
    }


    /**
     * 跳转到报听写
     *
     * @param goBackId
     * @param act
     * @param workId
     * @param downLoadInfo
     * @param module
     * @param position
     * @param requestCode
     * @param classId
     * @param versionId
     * @param workType
     * @param isWordsRepeat
     * @param workContents
     */
    public static void jumpToDictaionNew(int goBackId, Activity act, String workId,
                                         DownLoadInfo downLoadInfo, Module module,
                                         int position, int requestCode, String classId, String versionId, int workType, boolean isWordsRepeat, WorkContents workContents, long effectiveDate) {

        if (isContainsActivityInStack(DictationActivity.class)) {
            return;
        }

        Intent intent = getBaseIntent(goBackId, act, DictationActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);


        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, workType);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, isWordsRepeat);
        intent.putExtra(IntentFlag.INTENT_FLAG_REQUEST_CODE_FROM, requestCode);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);


        if (null != versionId) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENT, versionId);
        }

        if (null != workContents) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContents);
            intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                    workContents.getCheckedResource());
        }
        act.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到报听写
     *
     * @param goBackId
     * @param module
     * @param act
     * @param audioList
     */
    public static void jumpToDictaion(Answer answer, int goBackId, Activity act, Module module,
                                      ArrayList<String> audioList) {
        Intent intent = getBaseIntent(goBackId, act, TheHearingActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, audioList);
        intent.putExtra(IntentFlag.INTENT_FLAG_ANSWER, answer);

        act.startActivity(intent);
    }

    public static void jumpToDictaionFromRedo(int goBackId, Activity act, WordDetail wordDetail, DownLoadInfo mDownLoadInfo, boolean isWordsRepaet
            , int requestCode, String title, DictationAnswerInfo dictationAnswerInfo) {
        Intent intent = getBaseIntent(goBackId, act, DictationActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, (Serializable) wordDetail);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, isWordsRepaet);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, mDownLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_TITLE, title);
        intent.putExtra(IntentFlag.INTENT_FLAG_ANSWER, dictationAnswerInfo);
        act.startActivityForResult(intent, requestCode);
    }


    public static void jumpToDictaionRedoAndResult(int goBackId, Activity act, List<WordDetail> words,
                                                   DownLoadInfo downLoadInfo, Module module, int position,
                                                   CopyOnWriteArrayList<DictationAnswerInfo> dictationAnswerInfoCopyOnWriteArrayList,
                                                   String title, Answer answer, String uuid, int worklong, WorkContents workContent, long effectiveDate) {
        Intent intent = getBaseIntent(goBackId, act, DictationRedoAndResultActivity.class);
        Bundle mBundle = new Bundle();
        mBundle.putSerializable(IntentFlag.INTENT_FLAG_WORDSLIST, (Serializable) words);
        ArrayList<DictationAnswerInfo> listenspeakAnswerInfos = new ArrayList<>();
        if (dictationAnswerInfoCopyOnWriteArrayList != null) {
            for (int i = 0; i < dictationAnswerInfoCopyOnWriteArrayList.size(); i++) {
                DictationAnswerInfo dictationAnswerInfo = dictationAnswerInfoCopyOnWriteArrayList.get(i);
                listenspeakAnswerInfos.add(dictationAnswerInfo);
            }
        }
        mBundle.putSerializable(IntentFlag.INTENT_FLAG_USERANSWERLIST, listenspeakAnswerInfos);
        mBundle.putSerializable(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, mBundle);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_MODULE, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_TITLE, title);
        intent.putExtra(IntentFlag.INTENT_FLAG_ANSWER, answer);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, worklong);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);
        if (null != workContent) {
            intent.putExtra(IntentFlag.INTENT_FLAG_WORK_CONTENTS, workContent);
        }
        act.startActivity(intent);
    }

    /**
     * 跳转到书籍目录页面
     *
     * @param goBackId
     * @param context
     * @param info
     * @param from        来源IntentValue.JumpToBookCatalogType
     * @param requestCode
     */
    public static void jumpToCatalogFromSearching(int goBackId, Activity context,
                                                  EpaperInfo info, int from, int requestCode, int serviceId) {
        Intent intent = getBaseIntent(goBackId, context, CatalogNewActivity.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, info);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_ACTION, from);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        context.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到书籍目录页面
     *
     * @param goBackId
     * @param context
     * @param info
     * @param from        来源IntentValue.JumpToBookCatalogType
     * @param requestCode
     */
    public static void jumpToCatalog(int goBackId, Activity context,
                                     EpaperInfo info, int from, int requestCode, int serviceId) {
        Intent intent = getBaseIntent(goBackId, context, CatalogNewActivity.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, info);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_ACTION, from);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        context.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到书籍目录页面
     *
     * @param goBackId
     * @param context
     * @param info
     * @param from        来源IntentValue.JumpToBookCatalogType 扫码进入
     * @param requestCode
     */
    public static void jumpToCatalog(int goBackId, Activity context,
                                     EpaperInfo info, int from, int requestCode, List<EpaperInfo.Server> serverList) {
        Intent intent = getBaseIntent(goBackId, context, CatalogNewActivity.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, info);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_ACTION, from);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, (Serializable) serverList);
        context.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到书籍内容页面
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     * @param info     下载对象
     */
    public static void jumpToContent(int goBackId, Activity act, DownLoadInfo info, int serviceId, EpaperInfo epaperInfo, List<EpaperInfo.Server> serverList) {
        if (isContainsActivityInStack(NewContentActivity.class)) {
            return;
        }
        Intent intent = getBaseIntent(goBackId, act, NewContentActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, info);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, epaperInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, (Serializable) serverList);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        act.startActivity(intent);
    }

    /**
     * 跳转到书籍内容页面
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     */
    public static void jumpToNewReadContent(int goBackId, Activity act, NewBookReadBean bean, int fromResource) {

        Intent intent = getBaseIntent(goBackId, act, NewReadContentActivity.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, bean);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, fromResource);
        act.startActivity(intent);
    }

    public static void jumpToNewBookDetailH5Activity(final BaseActivity mActivity, final NewBookReadBean readBean, final DownLoadInfo downLoadInfo, final int position, final int serviceId, final int from, final String workId, final int contentId, final int requestCode) {

        ZipPackageUtils.checkHtmlFileNeedDownload(mActivity, new BaseCallBack() {
            @Override
            public void success(Object data) {
                super.success(data);
                EventBus.getDefault().post(new HideDownloadDialogBean(true));


                if (isContainsActivityInStack(InteractiveTutorialCordovaActivity.class)) {
                    return;
                }

                Log.e("CordovaActivity"," moduleContent "+ GsonUtil.toJson(readBean) + " downLoadInfo "+ GsonUtil.toJson(downLoadInfo)+" from "+from+" workId "+workId+" contentId "+contentId+" requestCode "+requestCode +" position = "+position +" serviceId = "+serviceId);


                Intent onlineAnswerCordovaIntent = getBaseIntent(0, mActivity, NewBookDetailH5Activity.class);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_OBJ, readBean);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_H5_PAGE_TYPE_SOURCE, from);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_ID, contentId);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
                onlineAnswerCordovaIntent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
                onlineAnswerCordovaIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                mActivity.startActivityForResult(onlineAnswerCordovaIntent, requestCode);

            }

            @Override
            public void failed(int errorCode, Object data) {
                try {
                    EventBus.getDefault().post(new HideDownloadDialogBean(true));

                    if (!NetworkUtils.isOnline()) {
                        ToastUtil.INSTANCE.toastCenterNoNetError();
                    }
                } catch (Exception e) {

                }
            }

            @Override
            public void failed(Object data) {
                try {
                    EventBus.getDefault().post(new HideDownloadDialogBean(true));

                    if (!NetworkUtils.isOnline()) {
                        ToastUtil.INSTANCE.toastCenterNoNetError();
                    }
                } catch (Exception e) {

                }
            }
        });

    }


    /**
     * 跳转到书籍内容页面
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     */
    public static void jumpToContentNew(int goBackId, Activity act, CatalogueInfo catalogueInfo, int serviceId, EpaperInfo epaperInfo, List<EpaperInfo.Server> serverList, int fromResource) {

        Intent intent = getBaseIntent(goBackId, act, NewContentActivity2.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_CATALOGUE_INFO, catalogueInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, epaperInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, (Serializable) serverList);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, fromResource);
        act.startActivity(intent);
    }

    /**
     * 首页同步教材跳转到资源列表页
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     */
    public static void jumpToNewBookContentFromDesk(int goBackId, Activity act, String mBookId, String mCid, String resourceName, boolean isFromDesk) {

        Intent intent = getBaseIntent(goBackId, act, NewContentActivity2.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_BOOKID, mBookId);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_CID, mCid);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_FORM, isFromDesk);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_TITLE, resourceName);
        act.startActivity(intent);
    }

    /**
     * 跳转到做作业浏览器
     *
     * @param act
     * @param goBackId
     * @param jumpType     {@link DoWorkBrowerActivity.BrowerJumpType}
     * @param downLoadInfo 文件下载信息
     * @param module       章节详细内容
     * @param position     章节详细资源下标
     */
    public static void jumpToDoWorkBrowser(int goBackId, Activity act,
                                           int jumpType, DownLoadInfo downLoadInfo, Module module,
                                           int position) {
        jumpToDoWorkBrowser(goBackId, act, jumpType, downLoadInfo, module,
                position, "", "", "", null);
    }

    /**
     * 跳转到做作业浏览器
     *
     * @param act
     * @param goBackId
     * @param jumpType        {@link DoWorkBrowerActivity.BrowerJumpType}
     * @param downLoadInfo    文件下载信息
     * @param module          章节详细内容
     * @param position        章节详细资源下标
     * @param uuid            用户答案文件夹uuid
     * @param doWorkId        做作业ID
     * @param checkedResource 选中的资源
     */
    public static void jumpToDoWorkBrowser(int goBackId, Activity act,
                                           int jumpType, DownLoadInfo downLoadInfo, Module module,
                                           int position, String uuid, String doWorkId,
                                           String checkedResource, String comment) {
        Intent intent = getBaseIntent(goBackId, act,
                DoWorkBrowerActivity.class);
        intent.putExtra(BrowserActivity.IntentString.INTENT_STRING_TYPE,
                jumpType);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, doWorkId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);

        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);

        intent.putExtra(IntentFlag.INTENT_FLAG_TEACHER_COMMENT,
                comment);


        act.startActivity(intent);
    }

    /**
     * 跳转到听说模考学习记录页面
     */
    public static void jumpToNewLsWorkRecord(String mTeacherComment, int goBackId, Activity act,
                                             DownLoadInfo downLoadInfo, Module module,
                                             String checkedResource, String doWorkId, String resourceName, int workStatus, int position) {
        Intent intent = getBaseIntent(goBackId, act,
                NewLsWorkRcordActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_TEACHER_COMMENT,
                mTeacherComment);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, doWorkId);
        intent.putExtra(BrowserActivity.IntentString.INTENT_STRING_TITLE,
                resourceName);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_STATUS,
                workStatus);

        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);

        act.startActivity(intent);
    }


    /**
     * 跳转到做作业浏览器
     *
     * @param act
     * @param goBackId
     * @param jumpType        {@link DoWorkBrowerActivity.BrowerJumpType}
     * @param downLoadInfo    文件下载信息
     * @param module          章节详细内容
     * @param position        章节详细资源下标
     * @param uuid            用户答案文件夹uuid
     * @param doWorkId        做作业ID
     * @param checkedResource 选中的资源
     */
    public static void jumpToDoWorkBrowser(Answer answer, int goBackId, Activity act,
                                           int jumpType, DownLoadInfo downLoadInfo, Module module,
                                           int position, String uuid, String doWorkId,
                                           String checkedResource, String resourceName) {
        Intent intent = getBaseIntent(goBackId, act,
                DoWorkBrowerActivity.class);
        intent.putExtra(BrowserActivity.IntentString.INTENT_STRING_TYPE,
                jumpType);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_UUID, uuid);
        intent.putExtra(IntentFlag.INTENT_FLAG_ID, doWorkId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE,
                checkedResource);

        intent.putExtra(IntentFlag.INTENT_FLAG_ANSWER,
                answer);

        intent.putExtra(BrowserActivity.IntentString.INTENT_STRING_TITLE,
                resourceName);

        act.startActivity(intent);
    }

    //TEST
    public static void jumpToDowork(Activity act, int goBackId, String url,
                                    String titile) {
        Intent intent = getBaseIntent(goBackId, act,
                DoWorkBrowerActivity.class);
        act.startActivity(intent);
    }

    /**
     * 跳转到添加书籍
     *
     * @param goBackId    返回按钮的文字id
     * @param act         启动activity
     * @param fragment
     * @param requestCode 返回码
     */
    public static void jumpToAddBook(int goBackId, Activity act,
                                     Fragment fragment, int requestCode) {
        Intent intent = getBaseIntent(goBackId, act, AddBookActivity.class);
        act.startActivityForResult(intent, requestCode);
    }

    /**
     * ChooseSchool跳转到书柜
     *
     * @param goBackId
     * @param act
     * @param requestCode
     */
    public static void jumpToAddBook(int goBackId, Activity act, int requestCode) {
        Intent intent = getBaseIntent(goBackId, act, AddBookActivity.class);
        act.startActivityForResult(intent, requestCode);
    }

    /**
     * ChooseSchool跳转到书柜，再跳转到微商城
     *
     * @param goBackId
     * @param act
     * @param requestCode
     */
    public static void jumpToAddBookAndService(int goBackId, Activity act, int requestCode) {
        Intent intent = getBaseIntent(goBackId, act, AddBookActivity.class);
        intent.putExtra("jumpToService", true);
        act.startActivityForResult(intent, requestCode);
    }


    /**
     * 体验服务后返回到书柜列表
     *
     * @param goBackId
     * @param act
     */
    public static void jumpToAddBookAndService(int goBackId, Activity act, Service service) {
        Intent intent = getBaseIntent(goBackId, act, AddBookActivity.class);
        intent.putExtra("service", service);
        intent.putExtra("fromBookShop", true);
        act.startActivity(intent);
    }

    /**
     * 跳转到编辑书籍界面
     *
     * @param goBackId
     * @param act
     * @param fragment
     * @param epaperInfoList
     * @param requestCode
     */
    public static void jumpToEditBook(int goBackId, Activity act,
                                      Fragment fragment, List<EpaperInfo> epaperInfoList, int requestCode) {
        Intent intent = getBaseIntent(goBackId, act, EditBookActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST,
                (Serializable) epaperInfoList);
        fragment.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转设置页面
     *
     * @param goBackId
     * @param act
     */
    public static void jumpSystemToSetting(int goBackId, Activity act) {
//        Intent intent = new Intent(Settings.ACTION_SETTINGS);
//        intent.putExtra(INTENT_FLAG_SOURCE, true);
//        intent.putExtra(GO_BACK_ID, goBackId);
//        act.startActivity(intent);
        XXPermissionTool.startSettingActivity(act);
    }


    /**
     * 跳转到重新评分界面
     *
     * @param goBackId
     * @param context  来源IntentValue.JumpToBookCatalogType
     */
    public static void jumpToRetryPage(int goBackId, Activity context, String uuidKey, int workTime, String resPath, List<LswAnswer> retryUploadList, int requestCode) {
        Intent intent = getBaseIntent(goBackId, context, ListenSpeakRetryActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, (Serializable) retryUploadList);
        intent.putExtra(IntentFlag.INTENT_FLAG_STR, uuidKey);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, workTime);

        intent.putExtra(IntentFlag.INTENT_FLAG_EPAPER_RES_PATH, resPath);

        context.startActivityForResult(intent, requestCode);

    }

    /**
     * 跳转到搜索书籍页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpToSerachBook(int id, Activity context, int requestCode) {

        Intent intent = getBaseIntent(id, context, SearchBookActivity.class);
        context.startActivityForResult(intent, requestCode);

    }

    /**
     * 跳转到搜索书籍页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpToShopSerachBook(int id, Activity context, int requestCode) {

        Intent intent = getBaseIntent(id, context, ShopSearchBookActivity.class);
        context.startActivityForResult(intent, requestCode);

    }

    /**
     * 跳转到搜索书籍页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpToAllServiceOrBook(int id, Activity context, int type, int requestCode, Subject subject) {

        Intent intent = getBaseIntent(id, context, AllServiceOrBookActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, type);
        if (null != subject) {
            intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, subject);
        }
        context.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到banner广告页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpToBannerAdActivity(int id, Activity context, BannerBean bannerBean, int requestCode) {

        Intent intent = getBaseIntent(id, context, BannerAdActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, bannerBean);
        context.startActivityForResult(intent, requestCode);
    }

    public static void jumpToWrite(int id, Activity context) {

        Intent intent = getBaseIntent(id, context, JournalActivity.class);
        context.startActivity(intent);

    }

    public static void jumpToTestAct(int id, Activity context) {
        Intent intent = getBaseIntent(id, context, TestActicity.class);
        context.startActivity(intent);
    }


    /**
     * 跳转重做页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpLsRedo(BaseActivity context, int id, DownLoadInfo downLoadInfo, Module module, String checkedResource, int position,
                                  String workId, String classId, int totalTime, int serviceId, ArrayList<LswAnswer> userAnswerseList,
                                  ListenspeakExam listenspeakExam, WorkContents workContents, int lsMode,
                                  ArrayList<ResourceDetail> isDoRecords, int doWorkType, boolean isCorrect, long effectiveDate) {
        Intent intent = getBaseIntent(id, context, LswRedoActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_EXAM, listenspeakExam);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, totalTime);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, userAnswerseList);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_WORK_CONTENTS, workContents);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, lsMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_IS_DO_REDORD, isDoRecords);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_TYPE, doWorkType);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_EFFECTIV_TIME, effectiveDate);
        intent.putExtra(IntentFlag.INTENT_FLAG_CORRECT, isCorrect);
        context.startActivity(intent);
    }


    /**
     * 跳转重做页面
     *
     * @param id      返回图标ID
     * @param context
     */
    public static void jumpLsRedoNew(int id, Activity context, final DownLoadInfo downLoadInfo, String checkedResource,
                                     String workId, String classId, int totalTime, int serviceId, ArrayList<LswAnswer> userAnswerseList, ListenspeakExam listenspeakExam, int requestCode, WorkContents workContents, int lsMode, ArrayList<ResourceDetail> isDoRecords, int doWorkType) {

        Intent intent = getBaseIntent(id, context, LswRedoActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_DOWNLOAD_INFO, downLoadInfo);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_EXAM, listenspeakExam);
//        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
//        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, totalTime);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CHECKED_RESOURCE, checkedResource);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ_LIST, userAnswerseList);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_WORK_CONTENTS, workContents);
        intent.putExtra(IntentFlag.INTENT_FLAG_ACTION, lsMode);
        intent.putExtra(IntentFlag.INTENT_FLAG_LSW_IS_DO_REDORD, isDoRecords);
        context.startActivity(intent);
    }


    public static void jumpToLongConversation(int goBackId, Activity context,
                                              EpaperInfo info, int from, int requestCode, int serviceId) {
        Intent intent = getBaseIntent(goBackId, context, LongConversationActivity.class);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_OBJ, info);
        intent.putExtra(BaseIntentFlag.INTENT_FLAG_ACTION, from);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        context.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到打卡详情页面
     *
     * @param activity
     * @param workId
     */
    public static void jumpToUserDKWorkActivity(Activity activity, String workId, int goBackId) {
        Intent intent = getBaseIntent(goBackId, activity, UserDKWorkActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        activity.startActivity(intent);
    }


    public static void jumpToUserDkSubmit(Activity activity, int gobackid, DkWorkDetail dkWorkDetail, DKWorkDays dkWorkDays, int postion) {
        Intent intent = getBaseIntent(gobackid, activity, UserDkSubmitActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_DK_WORK_DETAIL, dkWorkDetail);
        intent.putExtra(IntentFlag.INTENT_FLAG_DK_WORK_DAYS, dkWorkDays);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, postion);
        activity.startActivity(intent);
    }


}
